Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/bbox

Package Overview
Dependencies
Maintainers
9
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/bbox

turf bbox module

  • 7.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
9
Created

What is @turf/bbox?

@turf/bbox is a module from the Turf.js library that calculates the bounding box (bbox) for a given GeoJSON object. A bounding box is an array that defines the minimum and maximum coordinates in the form [minX, minY, maxX, maxY]. This is useful for spatial analysis, mapping, and geographic data processing.

What are @turf/bbox's main functionalities?

Calculate Bounding Box

This feature calculates the bounding box for a single point. The output is an array representing the bounding box.

const turf = require('@turf/turf');
const point = turf.point([102.0, 0.5]);
const bbox = turf.bbox(point);
console.log(bbox); // Output: [102, 0.5, 102, 0.5]

Bounding Box for a Polygon

This feature calculates the bounding box for a polygon. The output is an array representing the bounding box.

const turf = require('@turf/turf');
const polygon = turf.polygon([[
  [100.0, 0.0],
  [101.0, 0.0],
  [101.0, 1.0],
  [100.0, 1.0],
  [100.0, 0.0]
]]);
const bbox = turf.bbox(polygon);
console.log(bbox); // Output: [100, 0, 101, 1]

Bounding Box for a Feature Collection

This feature calculates the bounding box for a feature collection containing multiple points. The output is an array representing the bounding box.

const turf = require('@turf/turf');
const point1 = turf.point([102.0, 0.5]);
const point2 = turf.point([103.0, 1.0]);
const featureCollection = turf.featureCollection([point1, point2]);
const bbox = turf.bbox(featureCollection);
console.log(bbox); // Output: [102, 0.5, 103, 1]

Other packages similar to @turf/bbox

Keywords

FAQs

Package last updated on 09 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc